package com.student.model;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * MessageBoard entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "MessageBoard", schema = "dbo", catalog = "StudentManager")
public class MessageBoard implements java.io.Serializable {

	// Fields

	private Long messageBoardId;
	private String messager;
	private Timestamp messageTime;
	private String messageContent;
	private Set<Reply> replies = new HashSet<Reply>(0);

	// Constructors

	/** default constructor */
	public MessageBoard() {
	}

	/** minimal constructor */
	public MessageBoard(Long messageBoardId, String messager,
			String messageContent) {
		this.messageBoardId = messageBoardId;
		this.messager = messager;
		this.messageContent = messageContent;
	}

	/** full constructor */
	public MessageBoard(Long messageBoardId, String messager,
			Timestamp messageTime, String messageContent, Set<Reply> replies) {
		this.messageBoardId = messageBoardId;
		this.messager = messager;
		this.messageTime = messageTime;
		this.messageContent = messageContent;
		this.replies = replies;
	}

	// Property accessors
	@Id
	@Column(name = "MessageBoard_id", unique = true, nullable = false, precision = 18, scale = 0)
	@GeneratedValue
	public Long getMessageBoardId() {
		return this.messageBoardId;
	}

	public void setMessageBoardId(Long messageBoardId) {
		this.messageBoardId = messageBoardId;
	}

	@Column(name = "Messager", nullable = false, length = 20)
	public String getMessager() {
		return this.messager;
	}

	public void setMessager(String messager) {
		this.messager = messager;
	}

	@Column(name = "Message_Time", length = 23)
	public Timestamp getMessageTime() {
		return this.messageTime;
	}

	public void setMessageTime(Timestamp messageTime) {
		this.messageTime = messageTime;
	}

	@Column(name = "Message_Content", nullable = false)
	public String getMessageContent() {
		return this.messageContent;
	}

	public void setMessageContent(String messageContent) {
		this.messageContent = messageContent;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "messageBoard")
	public Set<Reply> getReplies() {
		return this.replies;
	}

	public void setReplies(Set<Reply> replies) {
		this.replies = replies;
	}

}